//
//  CoGeRenderer.h
//  CoGe
//
//  Created by Tamas Nagy on 9/25/10.
//  Copyright 2010 home. All rights reserved.
//

#import <Cocoa/Cocoa.h>
#import <Quartz/Quartz.h>
#import <OpenGL/OpenGL.h>
#import "CoGeTextureSource.h"


@interface CoGeRenderer : NSObject <CoGeTextureSource> {
	
	CGLContextObj cgl_ctx;
	
	NSSize renderSize;
	
	QCRenderer *renderer;
	
	NSSize currentSize;
		
	
	NSString *compositionFilePath;
    
    CGColorSpaceRef colorSpace;
    
    BOOL canUseMSAA;
    
    
    NSThread *creatorThread;
    
    BOOL markedToRelease;
    
    GLuint texture;
 
    NSOpenGLContext *glContext;
    
}

@property (readwrite, retain) NSString *compositionFilePath;
@property (readwrite, nonatomic) BOOL canUseMSAA;
@property (readwrite, assign) NSThread *creatorThread;

-(void)setCIImageForInputKey:(CIImage *)img;

-(void)removeCachedTextureByManager;

-(void)cleanUpOnRenderingThread;

-(void)lockTexture;
-(void)unlockTexture;

-(id)initCoGeRendererWithPixelFormat:(NSOpenGLPixelFormat *)format
						   composition:(QCComposition *)composition 
						shareContext:(NSOpenGLContext *)shareContext;



- (QCComposition *)composition;

- (BOOL)setValue:(id)value forInputKey:(NSString *)key;
- (id)valueForInputKey:(NSString *)key;
- (id)valueForOutputKey:(NSString *)key;
- (id) valueForOutputKey:(NSString*)key ofType:(NSString*)type;
- (NSDictionary *)attributes;
- (NSArray *)inputKeys;
- (NSArray *)outputKeys;
@end
